﻿using System.Net;
using System.Threading;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SlSyncLibrary
{
    public class CallSynchronization<T> where T : System.ComponentModel.AsyncCompletedEventArgs
    {
        AutoResetEvent sync=new AutoResetEvent(false);
        T result;
        public void Completed(T result)
        {
            this.result=result;
            sync.Set();
        }

        public bool Wait()
        {
            return sync.WaitOne();
        }

        public T Result { get { return result; } }
    }
}
